package com.cn.zpark;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @PackageName: com.cn.zpark
 * @ClassName: SessionDemo02
 * @Description:
 * @author: RZS
 * @date: 2022/4/13  16:55
 */
@WebServlet("/sd2.do")
public class SessionDemo02 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // session域对象，绑定数据到session域中

        // 获取session
        HttpSession session = request.getSession();

        // 绑定数据到session域
        session.setAttribute("uname", "欢迎学习java");


    }
}
